Storage devices with a built-in storage medium have a buffer memory to temporarily store data exchanged with a host computer. Such a storage device performs control such that write data is stored in the buffer memory (write buffer) in response to a write command from the host computer, and the write data is sequentially read from the write buffer and written to the storage medium.
Generally, a low-cost dynamic random access memory (DRAM) that provides a large-capacity area is used as the buffer memory. However, in recent years, a static random-access memory (SRAM) capable of faster processing is sometimes used to meet demand for high speed processing. Since the SRAM is more expensive than the DRAM, a large-capacity area is hardly available and there is risk of a buffer overflow. There have been proposed various technologies for preventing buffer overflows. For example, according to a known technology, if the available capacity of the buffer memory is a predetermined value or less, data is once stored in a memory area different from the buffer memory and then transferred to the buffer memory to prevent buffer overflows.
In serial attached small computer system interface (SAS), it is necessary to previously notify an initiator side of a receivable data size using an XFER_RDY (transfer ready) signal, and the data having the notified data size is transferred from the initiator side. In this case, the free space in the write buffer at the time the initiator side is notified may be different from that at the time the data is transferred from the initiator side. Therefore, to prevent buffer overflows, there is a need for a technology capable of correctly managing the free space in the write buffer. Conventional technologies take into account only the current free space, and cannot specify the free space at the time the data is transferred.